home *** CD-ROM | disk | FTP | other *** search
/ Aminet 50 / Aminet 50 (2002)(GTI - Schatztruhe)[!][Aug 2002].iso / Aminet / text / edit / tecoc-146.lha / uminus.c < prev    next >
C/C++ Source or Header  |  1991-07-05  |  967b  |  29 lines

  1. /*****************************************************************************
  2.  
  3.     UMinus()
  4.  
  5.     This function is called when a command is executed which can have a
  6. numeric argument of "-",  like "-C".  The command "-C" really means "-1C".
  7. This function looks at the expression stack to see if it contains only a
  8. minus-sign operand.  It it does,  it is replaced with a -1 operator.
  9.  
  10. *****************************************************************************/
  11.  
  12. #include "zport.h"        /* define portability identifiers */
  13. #include "tecoc.h"        /* define general identifiers */
  14. #include "defext.h"        /* define external global variables */
  15.  
  16. VVOID UMinus()            /* turn '-' arg into -1 */
  17. {
  18.     ESptr    ESp;
  19.  
  20.     if (EStTop == (EStBot + 1)) {        /* if only one guy */
  21.         ESp = &(EStack[EStTop]);
  22.         if (ESp->ElType == OPERATOR &&    /* and it's an operator */
  23.             ESp->Elemnt == '-') {    /* and it's a minus sign */
  24.             ESp->Elemnt = -1L;    /* then convert to -1 */
  25.             ESp->ElType = OPERAND;
  26.         }
  27.     }
  28. }
  29.